package com.cszy.yydqbfq.adapter

import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.cszy.yydqbfq.R

import com.cszy.yydqbfq.bean.SongListBean


class GeDanpopListAdapter: BaseQuickAdapter<SongListBean,QuickViewHolder>() {

    // 控制是否显示选择图标（默认隐藏）
    public var isSelectionVisible = false
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: SongListBean?) {
        holder.setText(R.id.tv_name,item?.name)
        holder.setText(R.id.rv_song_count,item?.songs?.size.toString()+"首")
        Glide.with(context)
            .load(item?.cover)
            .placeholder(R.mipmap.ic_default_cover)
            .error(R.mipmap.ic_default_cover)
            .apply(
                RequestOptions()
                    .transform(RoundedCorners(8)) // 设置 4 个圆角，8dp
            )
            .into(holder.getView(R.id.iv_music_cover))

    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.item_gedanpop_list, parent)
    }




}